/*
 * main.cc
 *
 *  Created on: Nov 10, 2010
 *      Author: fify
 */

/*
 * The use of dynamical programming.
 * dp(i,j) states the total length of the two paths, one arrives at the i-th point and
 * the other at the j-th.
 *
 * We concluded:
 * dp(0,i) = dp(0,i-1) + dis(i-1,i);
 * XX dp(i,0) = dp(i-1,0) + dis(i-1,i);
 *
 * dp(i,i+1) = min{dp(i,k) + dis(k,i+1)}, where k = 0..i-1
 * XX dp(i+1,i) = min{dp(k,i) + dis(k,i+1)}, where k = 0..i-1
 *
 * dp(i,i+n) = dp(i,i+n-1) + dis(n-1,n), where n = 2..(N-i)
 */

/*
 * Note: Change float to double will put the solution into a dead place.
 */

#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

const int MAX = 1000;

float dp[MAX][MAX];
class Point
{
public:
	float x, y;
}points[MAX];

float work(int n);

int main()
{
	int n;

	while(scanf("%d", &n) != EOF)
	{
		float res = work(n);
		printf("%.2f\n", res);
	}

	return 0;
}

inline float getDistance(Point a, Point b)
{
	return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
float work(int n)
{
	for(int i = 0;i<n;i++)
	{
		scanf("%f%f", &points[i].x, &points[i].y);
		for(int j = 0;j<n;j++)
		{
			dp[i][j] = 1e100;
		}
	}

	dp[0][0] = 0;

	for(int i = 1;i<n;i++)
	{
		dp[0][i] = dp[0][i-1] + getDistance(points[i], points[i-1]);
	}

	for(int i = 1;i<n-1;i++)
	{
		for(int j = 0;j<=i-1;j++)
		{
			dp[i][i+1] = min(dp[i][i+1], dp[j][i] + getDistance(points[j], points[i+1]));
		}

		//printf("(%d,%d) = %f\n", i, i + 1,dp[i][i+1]);
		for(int j = i+2;j<n;j++)
		{
			dp[i][j] = dp[i][j-1] + getDistance(points[j-1], points[j]);
		}
	}

	for(int i = 0; i < n - 1;i++)
	{
		dp[n-1][n-1] = min(dp[n-1][n-1], dp[i][n-1] + getDistance(points[i], points[n-1]));
	}

	return dp[n-1][n-1];
}
